package com.project.nimsen.test;

import java.util.UUID;

import org.mortbay.jetty.Server;

public class JettyStart {
	public static final int PORT = 9180;
	public static final String CONTEXT = "/";

	public static void main(String[] args) throws Exception {
		/*Map<String, String> map = new HashMap<String, String>();
		map.put("1", "a");
		map.put("2", "b");
		map.put("3", "c");
		
		Map<String, String> map1 = new HashMap<String, String>();
		map1.putAll(map);
		map1.put("4", "d");
		for(Entry<String, String> en : map1.entrySet()){
			System.out.println("key:  "+en.getKey()+"      value:  "+en.getValue());
		}*/
		
		/*//扫描ip
		String ip_sbf = new String("172.16.16.");
		int count =0;
		for(int i=1;i<256;i++){
			String host = ip_sbf+i;
			InetAddress ia = InetAddress.getByName(host);
			boolean bool = ia.isReachable(1500);
			if(bool){
				count++;
				System.out.println(host+"  IP已用");
			}
		}
		System.out.println("共用"+count+"个IP。");*/
		//扫描端口
		/*long start = System.currentTimeMillis();
		byte[] ip = {(byte)192,(byte)168,(byte)1,(byte)0};
		for(int i = 2; i < 254; i++) {
			try {
				ip[3] = (byte)i;
				Socket socket = new Socket();
				socket.connect(new InetSocketAddress(InetAddress.getByAddress(ip), 20000), 80);
				System.out.println("Server's address 192.168.1." + i);
			}catch(Exception e) {
				System.out.println("Server is not address 192.168.1." + i);
			}
		}*/
		
		System.out.println(UUID.randomUUID());
		Server server = JettyUtils.buildDebugServer(PORT, CONTEXT);
		server.start();

		System.out.println("点击回车键后可以停止jetty服务");
		if (System.in.read() != 0) {
			server.stop();
			System.out.println("jetty服务已经停止");
		}
		
		/*
		 * 地址：114.215.99.36
mysql用户名：root
mysql密码：972e136cc4
ssh链接:ssh 172.16.88.41 -p 6059 -l root
		 */
	}
}
